package dahuiji.common.lister;


import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import org.apache.log4j.Logger;

import dahuiji.common.dao.BaseDaoAbstract;
import dahuiji.common.util.InitDataMemory;

/**
 * Application Lifecycle Listener implementation class ParamIntialListener
 * 
 */
public class ParamIntialListener implements ServletContextListener {
	Logger log = Logger.getLogger(ParamIntialListener.class);

	/**
	 * Default constructor.
	 */
	public ParamIntialListener() {
		// TODO Auto-generated constructor stub
	}

	/**
	 * @see ServletContextListener#contextInitialized(ServletContextEvent)
	 */
	public void contextInitialized(ServletContextEvent arg0) {
		// TODO Auto-generated method stub
		System.out.println("-----------服务器启动-------------");
		// 初始化hibernat
		try {
			
			//初始化line到内存
			InitDataMemory.initdate();//把所有航线都拿出来，然后把记录和航线对应
		} catch (Exception e) {
			// TODO: handle exception
			log.warn("系统初始化失败");
			System.out.println(e);
		}
	}

	/**
	 * @see ServletContextListener#contextDestroyed(ServletContextEvent)
	 */
	public void contextDestroyed(ServletContextEvent arg0) {
		System.out.println("-----------服务器关闭-------------");

	}

}
